/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.j;

import android.content.Context;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.f.b;
import com.qihoo.gamecenter.sdk.common.h.d;
import com.qihoo.gamecenter.sdk.common.h.d.a;
import com.qihoo.gamecenter.sdk.common.i.f;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.pay.k.c;
import java.util.Map;
import java.util.TreeMap;
import org.json.JSONArray;
import org.json.JSONObject;

public class i extends d {
    public i(Context paramContext, d.a parama) {
        super(paramContext, parama, true);
    }

    protected String a(Context paramContext, String[] paramArrayOfString) {
        return null;
    }

    protected String a() {
        return "http://mgame.360.cn/bankpay/query_limit.json";
    }

    protected boolean b() {
        return true;
    }

    protected Map b(Context paramContext, String[] paramArrayOfString) {
        return c(paramContext, paramArrayOfString);
    }

    private Map c(Context paramContext, String[] paramArrayOfString) {
        String str1 = a(0, paramArrayOfString);
        if (TextUtils.isEmpty(str1)) {
            c.b("MMQueryRiskLimitTask", new Object[] { "QueryRiskLimit: qihooId is null!" });
            return null;
        }
        String str2 = a(1, paramArrayOfString);
        if (TextUtils.isEmpty(str2)) {
            c.b("MMQueryRiskLimitTask", new Object[] { "QueryRiskLimit: access token is null!" });
            return null;
        }
        TreeMap localTreeMap = new TreeMap();
        localTreeMap.put("user_id", str1);
        localTreeMap.put("app_key", s.r(paramContext));
        localTreeMap.put("access_token", str2);
        String str3 = s.a(localTreeMap, s.s(paramContext));
        c.a("MMQueryRiskLimitTask", new Object[] { "params=", str3 });
        if (b()) {
            this.a = s.b();
            String str4 = f.c(str3, this.a);
            String str5 = b.a().a(this.a);
            localTreeMap = new TreeMap();
            localTreeMap.put("k", str5);
            localTreeMap.put("d", str4);
            c.a("MMQueryRiskLimitTask", new Object[] { a(), "?k=", str5, "&d=", str4 });
        }
        return localTreeMap;
    }

    protected a b(JSONObject paramJSONObject) {
        if (paramJSONObject != null) {
            a locala = new a();
            a.a(locala, paramJSONObject.optInt("error_code", -1));
            a.a(locala, paramJSONObject.optString("error"));
            if (TextUtils.isEmpty(a.a(locala)))
                a.a(locala, paramJSONObject.optString("error_msg"));
            if (locala.c()) {
                a.a(locala, paramJSONObject.optLong("pin_amount", 20000L));
                JSONArray localJSONArray = paramJSONObject.optJSONArray("valid_amounts");
                if (localJSONArray != null) {
                    int i = localJSONArray.length();
                    a.a(locala, new long[i]);
                    for (int j = 0; j < i; ++j)
                        a.b(locala)[j] = localJSONArray.optLong(j, -1L);
                }
            }
            return locala;
        }
        return null;
    }

    public static class a {
        private int a = -1;
        private String b;
        private long c;
        private long[] d;

        public long a() {
            return this.c;
        }

        public long[] b() {
            return this.d;
        }

        public boolean c() {
            return (this.a == 0);
        }
    }
}